stylecontext: Always recompute font
authorBenjamin Otte <otte@redhat.com>
Wed, 5 Dec 2012 17:41:40 +0000 (18:41 +0100)
committerBenjamin Otte <otte@redhat.com>
Thu, 6 Dec 2012 01:57:18 +0000 (02:57 +0100)
This is necessary  because values in a GtkCssComputedValues can change
now. So if the font-size is inherited or animated, the cached value will
be outdated.

Fixes the fontchooser preview not updating.

gtk/gtkstylecontext.c

index 5b17b2159c159906f5145f76c73a06b12d157bd6..fbd8e1717f64873216923cacb49632dff6504693 100644 (file)
@@ -3486,15 +3486,12 @@ gtk_style_context_get_font (GtkStyleContext *context,
 
   /* Yuck, fonts are created on-demand but we don't return a ref.
    * Do bad things to achieve this requirement */
-  description = g_object_get_data (G_OBJECT (data->store), "font-cache-for-get_font");
-  if (description == NULL)
-    {
-      gtk_style_context_get (context, state, "font", &description, NULL);
-      g_object_set_data_full (G_OBJECT (data->store),
-                              "font-cache-for-get_font",
-                              description,
-                              (GDestroyNotify) pango_font_description_free);
-    }
+  gtk_style_context_get (context, state, "font", &description, NULL);
+  g_object_set_data_full (G_OBJECT (data->store),
+                          "font-cache-for-get_font",
+                          description,
+                          (GDestroyNotify) pango_font_description_free);
+
   return description;
 }